/**
 * Created by PhpStorm.
 * User:  lm
 * Date:
 */

const util = {
    renderStatus(data){
        let text = '';
        switch (data) {
            case 'un_auth':
                text = '未认证'
                this.statusSet = '去认证'
                break;
            case 'audit':
                text = '认证中'
                this.statusSet = '撤回认证'
                break;
            case 'success':
                text = '认证成功'
                this.statusSet = '重新认证'
                break;
            case 'fail':
                text = '认证失败'
                this.statusSet = '重新认证'
                break;
            default:
                text = '未认证'
        }
        return text
    },
    renderAddress(data){
        if(!data) return false;
        let parse = JSON.parse(data),
            result = '',
            count = 0;
        for (let i in parse) {
            if (count == 0) result += parse[i]
            else result = result + '-' + parse[i]

            count++;
        }
        return result;
    },
    renderPrice(data) {
        if(!data)return false;
        let text = '面议';
        data += ''
        if (data.indexOf('-') != -1) {
            let array = data.split('-').map(item => item * 1);
            array = array.map(item => {
                if (item > 9999) {
                    let res = (Math.round((item / 10000) * 100) / 100)
                    return  res + '万'
                }
                return item
            })
            text = array.join('-')
        }
        return text
    },
}

export default util